import { Guid } from "../Utils/Guid";
import { IncomingMessage } from "./InComingMessage";
import { SideChannel } from "./SideChannel";

export enum ConfigurationType {
    ScreenResolution = 0,
    QualityLevel = 1,
    TimeScale = 2,
    TargetFrameRate = 3,
    CaptureFrameRate = 4
}


export class EngineConfigurationChannel extends SideChannel {


    _kEngineConfigId = "e951342c-4f7e-11ea-b238-784f4387d1f7";

    constructor() {
        super();
        this.channelId = new Guid(this._kEngineConfigId);
    }

    onMessageReceived(msg: IncomingMessage): void {
        const messageType = msg.readInt32();
        switch (messageType) {
            // case ConfigurationType.ScreenResolution:
            //     const width = msg.readInt32();
            //     const height = msg.readInt32();
            //     Screen.SetResolution(width, height, false);
            //     break;
            // case ConfigurationType.QualityLevel:
            //     const qualityLevel = msg.readInt32();
            //     QualitySettings.SetQualityLevel(qualityLevel, true);
            //     break;
            // case ConfigurationType.TimeScale:
            //     let timeScale = msg.readFloat32();
            //     const maxTimeScale = UNITY_EDITOR ? 100 : Number.POSITIVE_INFINITY;
            //     timeScale = Mathf.Clamp(timeScale, 1, maxTimeScale);
            //     Time.timeScale = timeScale;
            //     break;
            // case ConfigurationType.TargetFrameRate:
            //     const targetFrameRate = msg.readInt32();
            //     Application.targetFrameRate = targetFrameRate;
            //     break;
            // case ConfigurationType.CaptureFrameRate:
            //     const captureFrameRate = msg.readInt32();
            //     Time.captureFramerate = captureFrameRate;
            //     break;
            default:
                break;
        }
    }
}